"""
ASGI config for django3_websocket project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""

import os
import sys

import django
from django.core.asgi import get_asgi_application
from channels.routing import get_default_application

from apps.websocket.middleware import websockets

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django3_websocket.settings')

# application = get_asgi_application()    # 默认配置,只能能使用同步的http请求

# 使用原生websocket方式
# application = websockets(application)

# 使用channels做websocket方案
django.setup()
application = get_default_application()

